#!/bin/bash
# F. Dang

if [ $# -eq 0 ] ; then 
echo "Usage : $0 run"
exit 1
fi

DIR=./
EXEC=$1

INPUT_FILE="example_input_4k-4k.txt"
OUTPUT_FILE="script/data_par4msp_par.dat"

#Max number of procs
PROCS=12

#Number of executions
SAMPLES=5

echo "Script launches $SAMPLES executions of"
CMD="./run $PROCS $INPUT_FILE"
echo $CMD
echo $CMD >> $OUTPUT_FILE

for ((I = 1; I <= $SAMPLES ; I = I + 1))
do 
	for ((J = 1; J <= $PROCS ; J = J + 1))
	do 
		LOG_OUTPUT=$( ${DIR}$EXEC $J $INPUT_FILE)

		TIME=$( echo ${LOG_OUTPUT} | awk '{ print $(NF-1)}')

		echo -n "$TIME	" >> $OUTPUT_FILE
	done

	echo "" >> $OUTPUT_FILE
done

